<template>
    <sc-table-select
        placeholder="---请选择---"
        ref="tableselect"
        v-model="orgcodevalue"
        style="width: 300px"
        :pageId="pageId"
        :userCode="userCode"
        :purviewType="purviewType"
        :attrList="attrList"
        :valueList="valueList"
        :queryList="queryList"
        :orderList="orderList"
        :table-width="640"
        :multiple="multiple"
        :queryType="queryType"
        selectType="org"
        collapse-tags
        collapse-tags-tooltip 
        :props="props"
        :selectKeyValue="selectKeyValue"
        @change="change"
        @remove-tag="removeTag"
    >
        <!-- collapse-tags
        collapse-tags-tooltip-->
        <template #header="{}">
            <el-form :inline="true">
                <el-row :gutter="5">
                    <el-col :span="5">
                        <el-input
                            v-model="queryList.goodsCode"
                            placeholder="请输入编码"
                            style="width: 125px"
                            @keyup.enter="$refs.tableselect.getData()"
                        ></el-input>
                    </el-col>
                    <el-col :span="5">
                        <el-input
                            v-model="queryList.goodsName"
                            placeholder="请输入名称"
                            style="width: 125px"
                            @keyup.enter="$refs.tableselect.getData()"
                        ></el-input>
                    </el-col>
                    <el-col :span="5">
                        <el-input
                            v-model="queryList.goodsType"
                            placeholder="请输入分类编码"
                            style="width: 125px"
                            @keyup.enter="$refs.tableselect.getData()"
                        ></el-input>
                    </el-col>
                    <el-col :span="4">
                        <el-button type="primary" @click="$refs.tableselect.getData()">查询</el-button>
                    </el-col>
                </el-row>
            </el-form>
        </template>
        <el-table-column label="物料编码" prop="goodsCode" min-width="110" sortable></el-table-column>
        <el-table-column label="物料名称" prop="goodsName" min-width="180" sortable></el-table-column>
        <el-table-column label="单位" prop="uomName" min-width="120" sortable></el-table-column>
        <el-table-column label="物料规格" prop="standard" min-width="180" sortable></el-table-column>
        <el-table-column label="分类编码" prop="subGoodsType" min-width="180" sortable></el-table-column>
        <el-table-column label="分类名称" prop="typeName" min-width="180" sortable></el-table-column>
    </sc-table-select>
</template>

<script>
import tool from "@/utils/tool";
import bus from "@/utils/mitt";
export default {
    name: "orgselect",
    props: {
        pageId: { type: String, default: "" },
        multiple: { type: Boolean, default: true },
        userCode: { type: String, default: "super" },
        purviewType: { type: String, default: "super" },
        selectKeyValue: { type: String, default: "Code" },
    },
    data() {
        return {
            queryType: "pos-sale/org-good-pages",
            hideClearBtn: true,
            attrList: {},
            valueList: {},
            queryList: {},
            //apiObj: this.$API.demo.page,
            params: {
                name: "demoName",
            },
            orgcodevalue: [],
            props: {
                label: "goodsName",
                value: "itemCode",
                keyword: "keyword",
            },
            formatType(row, column) {
                // eslint-disable-next-line no-debugger
                ////debugger;
                console.log(row, column);
                switch (row.TypeCode) {
                    case "01":
                        return "直营店";
                    case "02":
                        return "加盟店";
                    default:
                        return "";
                }
            },
            lastOrgVal: [],
        };
    },
    computed: {},
    mounted() {},
    methods: {
        //值变化
        change(val) {
            if (Array.isArray(val)) {
                if (val.length == 0) {
                    this.$emit("fatherMethod", []);
                } else {
                    this.$emit("fatherMethod", val);
                }
            } else {
                if (val) {
                    this.$emit("fatherMethod", val);
                }
            }
        },
    },
};
</script>

<style>
.custom-org-el-select-close .el-tag__close {
    display: none !important;
}
</style>
